package net.zoneland.knowledge.config;

import net.zoneland.oadocs.sdk.service.impl.DocServiceClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * oa文档协作平台sdk配置.
 * @author cxz
 * @date 2022/3/27 15:02
 */
@Configuration
@ConfigurationProperties(prefix = "oadocs")
public class OaDocsSdkConfig {

    /**
     * 接口地址.
     */
    private String requestUrl;

    /**
     * 应用在服务中的注册ID.
     */
    private String appId;

    /**
     * 服务接口.
     * @return 业务接口
     */
    @Bean(name="docServiceClient")
    public DocServiceClient docServiceClient() {
        final DocServiceClient docServiceClient = new DocServiceClient(requestUrl, appId);
        return docServiceClient;
    }

    /**
     * 获取 接口地址.
     *
     * @return requestUrl 接口地址.
     */
    public String getRequestUrl() {
        return this.requestUrl;
    }

    /**
     * 设置 接口地址.
     *
     * @param requestUrl 接口地址.
     */
    public void setRequestUrl(final String requestUrl) {
        this.requestUrl = requestUrl;
    }

    /**
     * 获取 接入应用编码.
     *
     * @return appId 接入应用编码.
     */
    public String getAppId() {
        return this.appId;
    }

    /**
     * 设置 接入应用编码.
     *
     * @param appId 接入应用编码.
     */
    public void setAppId(final String appId) {
        this.appId = appId;
    }
}
